<template>
  <!-- 底部 -->
  <div class="my-footer">
    <!-- 全选 -->
    <div class="custom-control custom-checkbox">
      <input
        type="checkbox"
        class="custom-control-input"
        id="footerCheck"
        :checked="selectAll"
        @click="btn"
      >
      <label
        class="custom-control-label"
        for="footerCheck"
      >全选</label>
    </div>
    <!-- 合计 -->
    <div>
      <span>合计:</span>
      <span class="price">¥ {{totalCost}}</span>
    </div>
    <!-- 按钮 -->
    <button
      type="button"
      class="footer-btn btn btn-primary"
    >结算 ( {{allNumber}})</button>
  </div>
</template>

<script>
import { mapGetters, mapMutations } from "vuex";
//导入局部组件必须在scrip里面导入,在App里面导入
export default {
  // 组件名称
  name: '',
  // 组件参数 接收来自父组件的数据
  props: {},
  // 接收局部注册的组件
  components: {},
  // 组件数据
  data () {
    return {}
  },
  computed: {
    ...mapGetters(['allNumber', 'totalCost', 'selectAll']),
  },
  methods: {
    //   inversion
    ...mapMutations(['inversion']),
    btn (e) {
      this.inversion(e.target.checked)
    }
  },

}
</script>
<style lang="less" scoped>
.my-footer {
  position: fixed;
  z-index: 2;
  bottom: 0;
  width: 100%;
  height: 50px;
  border-top: 1px solid #ccc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
  background: #fff;

  .price {
    color: red;
    font-weight: bold;
    font-size: 15px;
  }
  .footer-btn {
    min-width: 80px;
    height: 30px;
    line-height: 30px;
    border-radius: 25px;
    padding: 0;
  }
}
</style>